<?
if ($c = stack('name')) {

	$s = array_extend( array(
		'path' => 'gallery', 
		'w' => 800, 'h' => 600, 
		'tnw' => 128, 'tnh' => 96, 'tnmode' => MI_FIT, 'imode' => MI_FIT,
		'gw' => 128, 'gh' => 96, 
		'gtpb' => 0,
		'param' => 'id', 
		'show_tn' => 1, 'nav' => 0, 'navigator' => 1, 'circular' => 0, 'autoscroll' => 0, 'fancybox' => 0,
		'caption' => ''), $DATA['components'][$c]['settings']);

	$s['path'] = $DATA['components'][$c]['settings']['path'] = FP_UPLOAD_PATH.$s['path'];

	$dx = array('objects' => datafetch_array('gallery2', $s['path']));	// load existing images list
	
	$dx['count'] = count($dx['objects']);
	$dx['cols'] = 6;
	$dx['rows'] = ceil($dx['count'] / $dx['cols']);
	
	$DATA['components'][$c]['data'] = $dx;
	unstack();
}